import React, { useState, useEffect } from 'react';
import { Form, Row, Col, Button, Select, DatePicker } from 'antd';
import axios from '../../../utils/myAxios';
const { Option } = Select;
const { RangePicker } = DatePicker;

const Othercesi = () => {
  const [form] = Form.useForm();
  // // 保存向后端发送的数据
  const [formObj, setformObj] = useState({})

  const [salesmanData, setSalesmanData] = useState([]);

  // 请求业务员的数据
  useEffect(() => {
    axios.post('/orlg/selectIdAndName').then(res => {
      console.log(res.data.data)
      const data = res.data.data
      var newData = []
      data.map((item) => newData.push({
        name: item.name,
        id: item.id
      }))
      setSalesmanData(newData)
    })

  }, []);

  //点击确认后会
  const onFinish = (values) => {
    console.log(values);
  }

  // 点击搜索按钮
  const onWorkSearchClick = () => {

  }

  return (
    <Form
      form={form}
      name="advanced_search"
      layout="horizontal"
      onFinish={onFinish}
    >
      <Row gutter={24}>
        <Col span={6}>
          <Form.Item
            name="endTime"
          >
            <RangePicker />
          </Form.Item>
        </Col>
        <Col span={4}>
          <Form.Item
            name="nameid"
            label="业务员"
            rules={[{ required: false, message: '请输入值' }]}>
            <Select>
              {
                salesmanData.map(item => {
                  return (<Option value={item.id} key={item.id}>{item.name}</Option>)
                })
              }
            </Select>
          </Form.Item>
        </Col>
        <Col span={4}>
          <Form.Item
            name="behavior"
            label="行为"
            rules={[{ required: false, message: '请输入值' }]}
          >
            <Select>
              <Option value="1">新增</Option>
              <Option value="2">修改</Option>
              <Option value="3">删除</Option>
              <Option value="4">查询</Option>
            </Select>
          </Form.Item>
        </Col>
        <Col span={4}>
          <Form.Item
            name="ccc"
            label="操作系统"
            rules={[{ required: false, message: '请输入值' }]}
          >
            <Select>
              <Option value="1">显示</Option>
              <Option value="2">不显示</Option>
            </Select>

          </Form.Item>
        </Col>
        <Col span={5}>
          <Button type="primary" onClick={onWorkSearchClick} htmlType="submit">
            确认
          </Button>
          <Button
            style={{
              margin: '0 8px',
            }}
            onClick={() => {
              form.resetFields();
            }}>
            清空
          </Button>
        </Col>
      </Row>
    </Form>
  );
}


export default Othercesi

